﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SurveySystem.Core;
using System.Web.Security;
using System.Web.ApplicationServices;
using System.Resources;
using System.Threading;

namespace SurveySystem.Web
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnReset_Click(object sender, EventArgs e)
        {
            ManagementBLL.ResetDb();
        }

        protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            if(User.Identity.Name != "")
                e.InputParameters["userName"] = User.Identity.Name;
        }

        protected void ObjectDataSource2_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            if (User.Identity.Name != "")
                e.InputParameters["userName"] = User.Identity.Name;
        }

        protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex < 0) return;
            User u = UsersBLL.GetUserById(e.Row.Cells[0].Text);
            e.Row.Cells[0].Text = String.IsNullOrEmpty(u.fullName) ? u.name : u.fullName;
        }

      
    }
}
